package com.dunqi.gpm.shunqing.home.adapter;

import android.support.annotation.Nullable;
import android.view.View;

import com.chad.library.adapter.base.BaseViewHolder;
import com.dunqi.gpm.shunqing.R;
import com.dunqi.gpm.shunqing.common.base.RecyclerAdapter;
import com.dunqi.gpm.shunqing.common.util.TimeUtil;
import com.dunqi.gpm.shunqing.home.bean.ProjectProblem;
import com.dunqi.gpm.shunqing.home.widget.NormalView;

import java.util.List;

/**
 * Created by 空 on 2018/1/2 0002.
 */
public class ProjectProblemAdapter extends RecyclerAdapter<ProjectProblem> {

    String[] problemStatuss = {"未知", "未处理", "已收集", "协调中", "已解决", "不能解决", "关闭"};

    public ProjectProblemAdapter(@Nullable List<ProjectProblem> data) {
        super(R.layout.item_project_problem, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, ProjectProblem item) {
        NormalView problem_type_view = helper.getView(R.id.problem_type_view);
        NormalView solve_time_view = helper.getView(R.id.solve_time_view);
        NormalView solve_company_view = helper.getView(R.id.solve_company_view);
        NormalView solve_people_view = helper.getView(R.id.solve_people_view);
        NormalView solve_des_view = helper.getView(R.id.solve_des_view);
        NormalView attach_branch_view = helper.getView(R.id.attach_branch_view);

        attach_branch_view.setVisibility(View.GONE);

        int problemStatus = item.getProblemStatus();

        problem_type_view.setText(problemStatuss[problemStatus]);
        solve_time_view.setText(TimeUtil.getTen(item.getCoordinationTime()));
        solve_company_view.setText(item.getCreatorOrgName());
        solve_people_view.setText(item.getCreatorName());
        solve_des_view.setText(item.getCoordinationSolutionDesc());
        attach_branch_view.setText(item.getCoordinationOrg());
    }
}
